//
//  UILabel+Extension.swift
//  HMWeibo
//
//  Created by wulei on 15/12/8.
//  Copyright © 2015年 wulei. All rights reserved.
//

import UIKit
extension UILabel {
    convenience init(title:String,
        fontSize: CGFloat = 14,
        color: UIColor = UIColor.darkGrayColor(),
        screenInset: CGFloat = 0){
        self.init()
        text = title
        textColor = color
        font = UIFont.systemFontOfSize(fontSize)
        numberOfLines = 0
            
            if screenInset == 0 {
                
                textAlignment = NSTextAlignment.Center
            } else {
                preferredMaxLayoutWidth = UIScreen .mainScreen().bounds.width - 2 * screenInset
                textAlignment = NSTextAlignment.Left
            }
        sizeToFit()
    }
}
